//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#if _MSC_VER > 1000
#pragma once
#endif

#if !defined(__CKTFSFILESYSTEM_H__)
#define __CKTFSFILESYSTEM_H__

#define _NO_CKTFSFILESYSTEM_CLASSOBJECT_
#include "_CKtfsFileSystem.h"
#include "stub.h"
#include "depend.h"

class CKtfsFileSystem : public _CKtfsFileSystem
{
public:

    CARAPI Sync();

    CARAPI GetRoot(
                    /* [out] */ IBasicDirectory * * piRoot);

    CARAPI Lookup(
                    /* [in] */ WString wstrPath,
                    /* [out] */ IBasicFile * * piBasicFile);

    CARAPI GetStat(
                    /* [out] */ FileSystemStat * pFileSystemStat);

    CARAPI Mount(
                    /* [in] */ WString type,
                    /* [in] */ WString dir,
                    /* [in] */ WString vDevName,
                    /* [in] */ UInt32 flags);

    CARAPI Unmount(
                    /* [in] */ WString dir,
                    /* [in] */ UInt32 flags);

    CARAPI BindDriver(
                    /* [in] */ WString wstrDevName);

    CARAPI UnbindDriver();

    CARAPI CalcFreeSpace(
                    /* [out] */ UInt64 * pTotalNumberOfBytes,
                    /* [out] */ UInt64 * pTotalNumberOfFreeBytes);

    CKtfsFileSystem();

    CKtfsFileSystem (int iDiskNo);

    ~CKtfsFileSystem();

    IStub *GetStub();

    void SetStub(IStub *pStub);

    void *operator new(size_t size) { return ::operator new(size); }

protected:
    int m_iDiskNo;

private:
    IBasicDirectory *m_pRootIBasicDirector;
    class CFatFile *m_pRootCFatFile;
    class fat_filesystem *m_pFileSystem;
    IStub *m_pStub;
};

#endif //!(__CBASICFILESYSTEM_H__)
